import 'package:flutter_test/flutter_test.dart';
import 'package:jdunion_plugin/jdunion_plugin.dart';
import 'package:jdunion_plugin/jdunion_plugin_platform_interface.dart';
import 'package:jdunion_plugin/jdunion_plugin_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockJdunionPluginPlatform 
    with MockPlatformInterfaceMixin
    implements JdunionPluginPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<void> initJdUnion(String version) {
    return Future.value(null);
  }

  @override
  Future openJDAppByUrl(String url) {
    return Future.value(null);
  }

  @override
  Future openJXAppByUrl(String url) {
    return Future.value(null);
  }
}

void main() {
  final JdunionPluginPlatform initialPlatform = JdunionPluginPlatform.instance;

  test('$MethodChannelJdunionPlugin is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelJdunionPlugin>());
  });

  test('getPlatformVersion', () async {
    JdunionPlugin jdunionPlugin = JdunionPlugin();
    MockJdunionPluginPlatform fakePlatform = MockJdunionPluginPlatform();
    JdunionPluginPlatform.instance = fakePlatform;
  
    expect(await jdunionPlugin.getPlatformVersion(), '42');
  });
}
